package dnl.jexem.camouflaj;

import java.io.Serializable;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;

import dnl.jexem.cmd.Command;

public class CommandInfo implements Serializable {

	private static final long serialVersionUID = 1L;

	public static DateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
	
	private Command command;
	
	private Date timestamp;

	public CommandInfo(Command command) {
		this.command = command;
	}
	
	public CommandInfo(Command command, Date timestamp) {
		this.command = command;
		this.timestamp = timestamp;
	}

	public String getCommandId() {
		return command.getId()+"_"+dateFormat.format(timestamp);
	}

	public Command getCommand() {
		return command;
	}

	public void setCommand(Command command) {
		this.command = command;
	}

	public Date getTimestamp() {
		return timestamp;
	}

	public void setTimestamp(Date timestamp) {
		this.timestamp = timestamp;
	}

	@Override
	public String toString() {
		return "CommandInfo [command=" + command + ", timestamp=" + timestamp
				+ "]";
	}

}
